cmake_minimum_required(VERSION 2.8.3)
project(pcloud_scans)

add_compile_options(-std=c++14)
SET(CMAKE_CXX_FLAGS "-std=c++0x")
SET(CMAKE_BUILD_TYPE "Release")

find_package(catkin REQUIRED
  geometry_msgs
  nav_msgs
  sensor_msgs
  roscpp
  rospy
  std_msgs
  tf
  pcl_conversions
)
find_package(Eigen3 REQUIRED)#独立的库函数，不属于ros
find_package(PCL 1.7 REQUIRED)#独立的库函数，不属于ros
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()

add_message_files(
  FILES
  LineSegment.msg
  LineSegmentList.msg
)
#generate_messages(
#  DEPENDENCIES
#  sensor_msgs
#)
generate_messages(
  DEPENDENCIES
  sensor_msgs
)
catkin_package(
  CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy std_msgs tf pcl_conversions sensor_msgs 
  DEPENDS EIGEN3 PCL 
  #INCLUDE_DIRS include
  

)
link_directories(${catkin_LIB_DIRS}  lib)
include_directories(
  include#链接头文件
  ${catkin_INCLUDE_DIRS} #链接ros库
	#${PCL_INCLUDE_DIRS}#链接pcl库
  #${EIGEN3_INCLUDE_DIRS}
  )
add_library(sp STATIC
            src/lib/base_point_cloud_deal.cpp
            src/lib/k_means.cpp
            src/lib/get_accessible_area.cpp
            src/lib/line_extractor.cpp
            src/lib/grid_Dz.cpp)#生成静态链接库(SHARED.so)，静态链接库（STATIC.a）,默认静态

SET (LIBRARY_OUTPUT_PATH ${catkin_LIB_DIRS}/lib)
add_executable(point_cloud_deal  src/point_cloud_deal.cpp)#生成可执行文件
#set (EXECUTABLE_OUTPUT_PATH ${catkin_LIB_DIRS}/bin)
# target_link_libraries(point_cloud_deal ${catkin_LIBRARIES} ${PCL_LIBRARIES} sp myhello.so)#设置target需要链接的库
target_link_libraries(point_cloud_deal ${catkin_LIBRARIES} ${PCL_LIBRARIES} sp)#设置target需要链接的库

